<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="bookshopstyle.css" />
        <script type="text/javascript">
            HTTP_GET_VARS=new Array();
            strGET=document.location.search.substr(1,document.location.search.length);
            if(strGET!='')
            {
                gArr=strGET.split('&');
                for(i=0;i<gArr.length;++i)
                {
                    v='';vArr=gArr[i].split('=');
                    if(vArr.length>1){v=vArr[1];}
                    HTTP_GET_VARS[unescape(vArr[0])]=unescape(v);
                }
            }
 
            function GET(v)
            {
                if(!HTTP_GET_VARS[v]){return 'undefined';}
                return HTTP_GET_VARS[v];
            }
            function searchField()
            {
                searchboxvalue=document.getElementById("searchBox").value;

                if(searchboxvalue=="Suchen..")
                {
                    document.getElementById("searchBox").style.color="black";
                    document.getElementById("searchBox").value="";
                }
                if(searchboxvalue=="")
                {
                    document.getElementById("searchBox").style.color="#D7D7D7";
                    document.getElementById("searchBox").value="Suchen..";
                }
            }
            function load()
            {
                if(GET('searchBox')!="undefined"&&GET('searchtyp')!="undefined")
                {
                  document.getElementById("searchBox").style.color="black";
                    document.getElementById("searchBox").value="";
                    document.getElementById("searchBox").value=GET('searchBox');
                  
                    if(GET('searchtyp')=="Title")
                        document.getElementById('searchtyp').selectedIndex=0;
                     if(GET('searchtyp')=="Author")
                          document.getElementById('searchtyp').selectedIndex=1;
                          if(GET('searchtyp')=="Verlag")
                               document.getElementById('searchtyp').selectedIndex=2;
                     result();         
                }
            }
           
            function result()
            {
                var xmlhttp;
                var str=document.getElementById("searchBox").value;
                if (str.length==0)
                { 
                    document.getElementById("results").innerHTML="";
                    return;
                }
                if (window.XMLHttpRequest)
                {// code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp=new XMLHttpRequest();
                }
                else
                {// code for IE6, IE5
                    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange=function()
                {
                    if (xmlhttp.readyState==4 && xmlhttp.status==200)
                    {
                        document.getElementById("results").innerHTML=xmlhttp.responseText;
                    }
                }
                var searchtyp=document.getElementById("searchtyp").value;
                xmlhttp.open("GET","BookShopServlet?searchtyp="+searchtyp+""+"&searchBox="+str,true);
                //xmlhttp.open("GET","gethint.asp?q="+str,true);
                xmlhttp.send();
            }
              function addtoBasket(isbn)
            {
                var xmlhttp;
               
                alert(isbn);
                if (window.XMLHttpRequest)
                {// code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp=new XMLHttpRequest();
                }
                else
                {// code for IE6, IE5
                    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange=function()
                {
                    if (xmlhttp.readyState==4 && xmlhttp.status==200)
                    {
                        //document.getElementById("results").innerHTML=xmlhttp.responseText;
                    }
                }
              
                xmlhttp.open("GET","AddtoBasket?isbn="+isbn,true);
                //xmlhttp.open("GET","gethint.asp?q="+str,true);
                xmlhttp.send();
            }
        </script>
    </head>
    <body>
        <form action="newhtml.html">
            <input type="submit" name="isbn" id="asdf" value="Add" onclick="addtoBasket(this.id)"/></form>
    </body>
</html>
